home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_gimp.idb / usr / freeware / share / gimp / scripts / glossy.scm.z / glossy.scm
Encoding:
GIMP Script-Fu Script  |  1999-07-21  |  6.2 KB  |  147 lines

  1. ; glossy-patterned-shadowed-and-bump-mapped-logo
  2. ; creates anything you can create with it :)
  3. ; (use it wisely, use it in peace...) 
  4. ;
  5. ; The GIMP -- an image manipulation program
  6. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  7. ;
  8. ; glossy gives a glossy outlook to your fonts (unlogical name, isn't it?)
  9. ; Copyright (C) 1998 Hrvoje Horvat
  10. ;
  11. ; This program is free software; you can redistribute it and/or modify
  12. ; it under the terms of the GNU General Public License as published by
  13. ; the Free Software Foundation; either version 2 of the License, or
  14. ; (at your option) any later version.
  15. ;
  16. ; This program is distributed in the hope that it will be useful,
  17. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. ; GNU General Public License for more details.
  20. ;
  21. ; You should have received a copy of the GNU General Public License
  22. ; along with this program; if not, write to the Free Software
  23. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24.  
  25. (define (script-fu-glossy-logo text size font blend-gradient-text blend-gradient-outline grow-size bg-color use-pattern-text pattern-text use-pattern-outline pattern-outline use-pattern-overlay pattern-overlay noninteractive shadow-toggle s-offset-x s-offset-y flatten-toggle)
  26.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  27.          (text-layer (car (gimp-text img -1 0 0 text 30 TRUE size PIXELS "*" font "*" "*" "*" "*")))
  28.          (width (car (gimp-drawable-width text-layer)))
  29.          (height (car (gimp-drawable-height text-layer)))
  30.          (bg-layer (car (gimp-layer-new img width height RGBA_IMAGE "Background" 100 NORMAL)))
  31.          (grow-me (car (gimp-layer-copy text-layer TRUE)))
  32.  
  33.          (old-gradient (car (gimp-gradients-get-active)))
  34.          (old-patterns (car (gimp-patterns-get-pattern)))
  35.          (old-fg (car (gimp-palette-get-foreground)))
  36.          (old-bg (car (gimp-palette-get-background))))
  37.  
  38.     (gimp-image-disable-undo img)
  39.     (gimp-image-resize img width height 0 0)
  40.  
  41.     (gimp-layer-set-name grow-me "Grow-me")
  42.     (gimp-image-add-layer img grow-me 1)
  43.     (gimp-image-add-layer img bg-layer 2)
  44.  
  45.     (gimp-palette-set-background bg-color)
  46.     (gimp-selection-all img)
  47.     (gimp-bucket-fill img bg-layer BG-BUCKET-FILL NORMAL 100 0 FALSE 0 0)
  48.     (gimp-selection-none img)                
  49.     (gimp-palette-set-background old-bg)
  50.  
  51.     (gimp-selection-layer-alpha img text-layer)
  52.  
  53. ; if we are going to use transparent gradients for text, we will (maybe) need to uncomment this
  54. ; this clears black letters first so you don't end up with black where the transparent should be
  55. ;    (gimp-edit-clear img text-layer)
  56.  
  57.     (if (= use-pattern-text TRUE)
  58.       (begin
  59.         (gimp-patterns-set-pattern pattern-text)
  60.         (gimp-bucket-fill img text-layer PATTERN-BUCKET-FILL NORMAL 100 0 FALSE 0 0)
  61.         (gimp-patterns-set-pattern old-patterns)))
  62.  
  63.     (if (= use-pattern-text FALSE)
  64.       (begin
  65.         (gimp-gradients-set-active blend-gradient-text)
  66.         (gimp-blend img text-layer CUSTOM NORMAL LINEAR 100 0 REPEAT-NONE FALSE 0 0 0 0 0 (+ height 5))))
  67.  
  68.     (gimp-selection-none img)
  69.  
  70.     (gimp-selection-layer-alpha img grow-me)
  71.     (gimp-selection-grow img grow-size)
  72.  
  73. ; if we are going to use transparent gradients for outline, we will (maybe) need to uncomment this
  74. ; I didn't put it in the options because there are already enough settings there and anyway, transparent
  75. ; gradients will be used very rarely (if ever)
  76. ;    (gimp-edit-clear img grow-me)
  77.  
  78.     (if (= use-pattern-outline TRUE)
  79.       (begin
  80.         (gimp-patterns-set-pattern pattern-outline)
  81.         (gimp-bucket-fill img grow-me PATTERN-BUCKET-FILL NORMAL 100 0 FALSE 0 0)
  82.         (gimp-patterns-set-pattern old-patterns)))
  83.  
  84.     (if (= use-pattern-outline FALSE)
  85.       (begin
  86.         (gimp-gradients-set-active blend-gradient-outline)
  87.         (gimp-blend img grow-me CUSTOM NORMAL LINEAR 100 0 REPEAT-NONE FALSE 0 0 0 0 0 (+ height 5))))
  88.  
  89.     (gimp-selection-none img)
  90.  
  91.     (plug-in-bump-map noninteractive img grow-me text-layer 110.0 45.0 3 0 0 0 0 TRUE FALSE 0)
  92.     (gimp-layer-set-mode text-layer SCREEN)
  93.  
  94.     (if (= use-pattern-overlay TRUE)
  95.       (begin
  96.         (gimp-selection-layer-alpha img grow-me)    
  97.         (gimp-patterns-set-pattern pattern-overlay)
  98.         (gimp-bucket-fill img grow-me PATTERN-BUCKET-FILL OVERLAY 100 0 FALSE 0 0)
  99.         (gimp-patterns-set-pattern old-patterns)
  100.         (gimp-selection-none img)))
  101.    
  102.   (if (= shadow-toggle TRUE)
  103.       (begin
  104.         (gimp-selection-layer-alpha img text-layer)
  105.         (set! dont-drop-me (car (script-fu-drop-shadow img text-layer s-offset-x s-offset-y 15 '(0 0 0) 80 TRUE)))
  106.         (set! width (car (gimp-image-width img)))
  107.         (set! height (car (gimp-image-height img)))
  108.         (gimp-selection-none img)))
  109.  
  110.   (if (= flatten-toggle TRUE)
  111.       (begin
  112.       (set! final (car (gimp-image-flatten img)))))
  113.  
  114.     (gimp-gradients-set-active old-gradient)
  115.     (gimp-palette-set-background old-bg)
  116.     (gimp-palette-set-foreground old-fg)
  117.     (gimp-image-enable-undo img)
  118.     (gimp-display-new img)))
  119.  
  120. (script-fu-register "script-fu-glossy-logo"
  121.                     "<Toolbox>/Xtns/Script-Fu/Logos/Glossy"
  122.                     "Creates anything you can create with it :)"
  123.  
  124.                     "Hrvoje Horvat (hhorvat@open.hr)"
  125.                     "Hrvoje Horvat"
  126.                     "14/04/1998"
  127.                     ""
  128.                     SF-VALUE "Text String" "\"Galaxy\""
  129.                     SF-VALUE "Font Size (in pixels)" "100"
  130.                     SF-VALUE "Font" "\"Eras\""
  131.                     SF-VALUE "Blend Gradient (text)" "\"Shadows_2\""
  132.                     SF-VALUE "Blend Gradient (outline)" "\"Shadows_2\""
  133.                     SF-VALUE "How big outline?" "5"
  134.             SF-COLOR "Background Color" '(255 255 255)
  135.             SF-TOGGLE "Use pattern for text instead of gradient" FALSE
  136.             SF-VALUE "Pattern (text)" "\"Electric Blue\""
  137.             SF-TOGGLE "Use pattern for outline instead of gradient" FALSE
  138.             SF-VALUE "Pattern (outline)" "\"Electric Blue\""
  139.             SF-TOGGLE "Use pattern overlay" FALSE
  140.             SF-VALUE "Pattern (overlay)" "\"Parque #1\""
  141.             SF-TOGGLE "Default bump-map settings" TRUE
  142.             SF-TOGGLE "Shadow?" TRUE
  143.             SF-VALUE "Shadow X offset" "8"
  144.                     SF-VALUE "Shadow Y offset" "8"
  145.             SF-TOGGLE "Flatten image?" FALSE)
  146.  
  147.